package com.bjtu.restaurantreviews.dao;

import com.bjtu.restaurantreviews.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserRepository extends JpaRepository<User,Long> {
    //通过手机号查询
    public List<User> findByUphone(String uphone);
    //通过手机号和密码查询
//    public List<User> findByUphoneAndUpassword(String uphone,String upassword);
    @Query(value = "update User set upassword=?1 where uphone=?2",nativeQuery = true)
    @Modifying
    public void updatepwd(String upassword,String uphone);

    @Query(value = "select * from user where uid=?1",nativeQuery = true)
    @Modifying
    public List<User> userinfo(Integer uid);
}
